<?php

$page = $_GET['page'];
$sort = $_GET['sort'];
$rp = $_GET['rp'];
$rows = array();

for($i=0;$i<150;$i++){
    $rows[] = array(
        'nombre'=>"nombre $i",
        'direccion'=>"direccion $i",
        'sector_name'=>"sector_name $i",
        'SectorId'=>"SectorId $i",
        'ciudad'=>"ciudad $i"
    );
}

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');

if(!empty($sort)){
    $sort = json_decode($sort);
    if(!empty($sort->field))
        sort($rows);
    else ksort($rows);
}


echo json_encode(
    array(
        'success'=>true,
        'data'=>array(
            'total'=>100,
            'rows'=>$rows,
            'page'=>$page++
        )
    )
);


?>
